CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

PROJECT(xredis++)

option(C++11_ENABLE "C++11_ENABLE" ON)

SET(CMAKE_C_COMPILER "/usr/bin/gcc")
SET(CMAKE_CXX_COMPILER "/usr/bin/c++")

IF(C++11_ENABLE)
    IF(APPLE)
    ELSEIF(UNIX)
        SET(CMAKE_C_COMPILER "/opt/rh/devtoolset-2/root/usr/bin/gcc")
        SET(CMAKE_CXX_COMPILER "/opt/rh/devtoolset-2/root/usr/bin/c++")
    ENDIF()
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ")
ELSE()
    IF(APPLE)
    ELSEIF(UNIX)
        SET(CMAKE_C_COMPILER "/usr/bin/gcc")
        SET(CMAKE_CXX_COMPILER "/usr/bin/c++")
    ENDIF()
ENDIF()


MESSAGE("CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -g -fPIC -Wall -D_REENTRANT -DUSE_APACHE -DNO_STRING_CIPHER ")
SET(TARGET "xredis")
SET(LIBRARY_OUTPUT_PATH ../lib/release_linux/libRedis)

AUX_SOURCE_DIRECTORY(src SOURCE_DIRS_SRC)

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include)

LINK_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../lib/release_linux/libRedis)

#add_executable(BaseSocket ${SOURCE_DIRS})

ADD_LIBRARY(${TARGET} STATIC ${SOURCE_DIRS_SRC})

TARGET_LINK_LIBRARIES(${TARGET} -lhiredis -lnsl -lc -lm -lpthread -lstdc++)
